import { uploadType } from '@/utils/util'

const tableConfig = {
	stripe: true,
	border: true,
	maxHeight: '80vh',
	columns: [
		{
			label: '变更批次号',
			prop: 'id',
		},
		{
			label: '变更人/变更单位',
			prop: 'changePerson',
			render: ({ row }) => {
				return [row.changePerson, row.changePersonUnit].filter(Boolean).join('/')
			},
		},
		{
			label: '变更类型',
			prop: 'changeType',
		},
		{ label: '变更时间', prop: 'changeDate' },
		{ label: '变更说明', prop: 'changeDescription' },
		{
			label: '受理人/受理单位',
			prop: 'changeReceiver',
			render: ({ row }) => {
				return [row.changeReceiver, row.changeAcceptanceUnit].filter(Boolean).join('/')
			},
		},
		{ label: '受理时间', prop: 'processingDate' },
		{
			label: '处理状态',
			prop: 'processingStatus',
			custome: 'tag',
			dicData: [
				{ label: '已处理', value: 1, type: 'success' },
				{ label: '待处理', value: 0, type: 'danger' },
			],
		},
		{
			label: '处理结果',
			prop: 'processingResults',
			custome: 'tag',
			dicData: [
				{ label: '通过', value: 1, type: 'success' },
				{ label: '驳回', value: 0, type: 'danger' },
			],
		},
		{
			label: '操作',
			prop: 'menu',
			width: 300,
			fixed: 'right',
		},
	],
}
export const AppealHandleConfig = (status) => {
	return {
		label: '其他信息',
		prop: 'dp_service_object_other',
		inline: false,
		showBtn: status == 0,
		labelPosition: 'left',
		column: [
			//--------------------经济状况 ----------------
			{
				type: 'DividerHtml',
				modelValue: '变更数据',
				span: 24,
			},
			{
				prop: 'appeal_data',
				span: 24,
			},
			{
				type: 'DividerHtml',
				modelValue: '变更材料',
				span: 24,
			},
			{
				prop: 'appeal_material',
				span: 12,
			},
			{
				prop: 'appeal_content',
				span: 12,
			},
			{
				type: 'DividerHtml',
				modelValue: '处理结果',
				span: 24,
			},
			{
				prop: 'flagResult',
				display: status !== 0,
				labelPosition: 'top',
				span: 24,
			},
			{
				label: '处理结果',
				prop: 'flag',
				type: 'radio',
				display: status == 0,
				dicData: [
					{ label: '通过', value: 1 },
					{ label: '驳回', value: 0 },
				],
				control: (e, model) => {
					return {
						message: {
							display: e == 0,
						},
					}
				},
				rules: [{ required: true, message: '请选择处理结果' }],
				span: 24,
			},
			{
				label: '驳回原因',
				prop: 'message',
				type: 'textarea',
				display: status == 0,
				maxlength: '140',
				span: 24,
				showWordLimit: true,
			},
			{
				label: '相关材料',
				prop: 'material',
				type: 'upload',
				display: status == 0,
				fileType: uploadType.fileMetaType,
				listType: 'text',
				labelPosition: 'top',
				showFileList: true,
				limit: 4,
				multiple: true,
				span: 24,
			},
		],
	}
}
export const baseConfig: any = {
	pageName: '数据变更',
	dictcodes: [],
	rowKey: 'id',
	addLabel: '新增',
	tipLabel: 'changePerson',
	exportMqTopic: '/ning/export',
	api: {
		index: 'view_dpDataChange_page',
		add: 'view_dpDataChange_add',
		edit: 'view_dpDataChange_edit',
		delete: 'view_dpDataChange_del',
		export: 'view_dpDataChange_export',
		detail: 'view_dataChangeContent_page',
	},
	auth: {
		index: 'view_dpDataChange_page',
		delete: 'view_dpDataChange_del',
		mulitSet: 'mulitSet',
		export: 'view_dpDataChange_export',
	},
	menuBtn: [
		{
			icon: 'editor',
			label: '查看明细',
			type: 'primary',
			operate: 'audit',
			auth: 'view_dpDataChange_page',
			text: true,
			show: true,
		},
	],
	dialogConfig: {
		width: '65%',
	},
	searchConfig: {
		inline: true,
		showBtn: true,
		labelPosition: 'left',
		column: [
			{
				label: '批次号码',
				prop: 'id',
				type: 'input',
				span: 6,
			},
			{
				label: '变更人',
				prop: 'changePerson',
				type: 'input',
				span: 6,
			},
			{
				label: '变更单位',
				prop: 'changePersonUnit',
				type: 'input',
				span: 6,
			},
			{
				label: '受理人',
				prop: 'changeReceiver',
				type: 'input',
				span: 6,
			},
			{
				label: '受理单位',
				prop: 'changeAcceptanceUnit',
				type: 'input',
				span: 6,
			},
			{
				label: '变更类型',
				prop: 'changeType',
				type: 'input',
				span: 6,
			},
			{
				label: '处理状态',
				prop: 'processingStatus',
				type: 'select',
				dicData: [
					{ label: '已处理', value: 1 },
					{ label: '待处理', value: 0 },
				],
				span: 6,
			},
			{
				label: '处理结果',
				prop: 'processingResults',
				type: 'select',
				dicData: [
					{ label: '通过', value: 1 },
					{ label: '驳回', value: 0 },
				],
				span: 6,
			},
			{
				label: '变更日期',
				prop: 'changeDateBetween',
				type: 'datetimerange',
				format: 'YYYY年MM月DD HH:mm:ss',
				valueFormat: 'YYYY-MM-DD HH:mm:ss',
				span: 8,
			},
		],
	},
	tableConfig,
}
